#pragma once

#ifndef __SCRIPT__EDITOR__SOLUTION__TREE__HH__
#define __SCRIPT__EDITOR__SOLUTION__TREE__HH__

#include <qtreewidget>
#include "ScriptEditorPrereqs.h"

namespace Lit
{
	namespace Editor
	{
		class ScriptSolutionTree : public QTreeWidget
		{
			Q_OBJECT

		protected:
			QTreeWidgetItem * mRoot;
			ScriptSolutionPtr mSolution;
		public:
			ScriptSolutionTree( QWidget * parent );
			~ScriptSolutionTree();
			
			void setSolution( ScriptSolutionPtr sol );
			ScriptSolutionPtr& getSolution();
			const ScriptSolutionPtr& getSolution() const;

			QTreeWidgetItem*		getRoot();
			const QTreeWidgetItem*	getRoot() const;

			void newSolution( const std::string &name );
			QTreeWidgetItem * addFile( const std::string &name );
			
			void showContextMenu( const QPoint & pos );
			void mousePressEvent( QMouseEvent * evt );

		protected slots:
				void showScript(QTreeWidgetItem*itm, int col);
				void _itemDoubleClicked(QTreeWidgetItem*itm, int col);
				void _itemClicked(QTreeWidgetItem*itm, int col);

		signals:
			void scriptDoubleClicked( ScriptSolutionItemPtr );
			void scriptClicked( ScriptSolutionItemPtr );
			void scriptRightClicked( ScriptSolutionItemPtr );
		};
	};
};
#endif